class RotaryTableModel {
  String rotaryTableId;
  String title;
  String description;
  String currentTime;
  String prepareStartDate;
  String prepareEndDate;
  String prepareEndTime;
  String startDate;
  String endDate;
  String startTime;
  String endTime;
  bool everydayFree;
  // 每天免费10次
  int everydayFreeCount;
  bool pay;
  double payAmount;
  // 追加、充值
  bool topUpPresented;
  double topUpAmount;
  bool candyExchange;
  int candyExchangeAmount;
  // 规则
  String rule;
  String backgroundImageUrl;
  String rotaryTableImageUrl;
  // 还剩多少次？
  int residueLotteryCount;
  List<PrizeInfos> prizeInfos;

  RotaryTableModel(
      {this.rotaryTableId,
      this.title,
      this.description,
      this.currentTime,
      this.prepareStartDate,
      this.prepareEndDate,
      this.prepareEndTime,
      this.startDate,
      this.endDate,
      this.startTime,
      this.endTime,
      this.everydayFree,
      this.everydayFreeCount,
      this.pay,
      this.payAmount,
      this.topUpPresented,
      this.topUpAmount,
      this.candyExchange,
      this.candyExchangeAmount,
      this.rule,
      this.backgroundImageUrl,
      this.rotaryTableImageUrl,
      this.residueLotteryCount,
      this.prizeInfos});

  RotaryTableModel.fromJson(Map<String, dynamic> json) {
    rotaryTableId = json['rotaryTableId'];
    title = json['title'];
    description = json['description'];
    currentTime = json['currentTime'];
    prepareStartDate = json['prepareStartDate'];
    prepareEndDate = json['prepareEndDate'];
    prepareEndTime = json['prepareEndTime'];
    startDate = json['startDate'];
    endDate = json['endDate'];
    startTime = json['startTime'];
    endTime = json['endTime'];
    everydayFree = json['everydayFree'];
    everydayFreeCount = json['everydayFreeCount'];
    pay = json['pay'];
    payAmount = json['payAmount'];
    topUpPresented = json['topUpPresented'];
    topUpAmount = json['topUpAmount'];
    candyExchange = json['candyExchange'];
    candyExchangeAmount = json['candyExchangeAmount'];
    rule = json['rule'];
    backgroundImageUrl = json['backgroundImageUrl'];
    rotaryTableImageUrl = json['rotaryTableImageUrl'];
    residueLotteryCount = json['residueLotteryCount'];
    if (json['prizeInfos'] != null) {
      prizeInfos = new List<PrizeInfos>();
      json['prizeInfos'].forEach((v) {
        prizeInfos.add(new PrizeInfos.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['rotaryTableId'] = this.rotaryTableId;
    data['title'] = this.title;
    data['description'] = this.description;
    data['currentTime'] = this.currentTime;
    data['prepareStartDate'] = this.prepareStartDate;
    data['prepareEndDate'] = this.prepareEndDate;
    data['prepareEndTime'] = this.prepareEndTime;
    data['startDate'] = this.startDate;
    data['endDate'] = this.endDate;
    data['startTime'] = this.startTime;
    data['endTime'] = this.endTime;
    data['everydayFree'] = this.everydayFree;
    data['everydayFreeCount'] = this.everydayFreeCount;
    data['pay'] = this.pay;
    data['payAmount'] = this.payAmount;
    data['topUpPresented'] = this.topUpPresented;
    data['topUpAmount'] = this.topUpAmount;
    data['candyExchange'] = this.candyExchange;
    data['candyExchangeAmount'] = this.candyExchangeAmount;
    data['rule'] = this.rule;
    data['backgroundImageUrl'] = this.backgroundImageUrl;
    data['rotaryTableImageUrl'] = this.rotaryTableImageUrl;
    data['residueLotteryCount'] = this.residueLotteryCount;
    if (this.prizeInfos != null) {
      data['prizeInfos'] = this.prizeInfos.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class PrizeInfos {
  int id;
  String imageUrl;
  String type;
  String name;
  double amount;
  String description;
  List<String> entityImageUrls;

  PrizeInfos(
      {this.id,
      this.imageUrl,
      this.type,
      this.name,
      this.amount,
      this.description,
      this.entityImageUrls});

  PrizeInfos.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    imageUrl = json['imageUrl'];
    type = json['type'];
    name = json['name'];
    amount = json['amount'];
    description = json['description'];
    entityImageUrls = json['entityImageUrls'].cast<String>();
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['imageUrl'] = this.imageUrl;
    data['type'] = this.type;
    data['name'] = this.name;
    data['amount'] = this.amount;
    data['description'] = this.description;
    data['entityImageUrls'] = this.entityImageUrls;
    return data;
  }
}